package com.example.rbacmanage.service.system.impl;

import com.example.rbacmanage.entity.system.RoleMemu;
import com.example.rbacmanage.mapper.system.RoleMenuMapper;
import com.example.rbacmanage.service.system.RoleMenuService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RoleMenuServiceImpl implements RoleMenuService {
    @Autowired
    private RoleMenuMapper roleMenuMapper;
    @Override
    public void save(RoleMemu userMemu) {
        roleMenuMapper.insert(userMemu);
    }

    @Override
    public void remove(Long[] ids) {
        for(Long id:ids){
            roleMenuMapper.del(id);
        }
    }

    @Override
    public void update(RoleMemu userMemu) {
        roleMenuMapper.update(userMemu);
    }

    @Override
    public List<RoleMemu> getAll(RoleMemu userMemu) {
        return roleMenuMapper.list(userMemu);
    }

    @Override
    public PageInfo<RoleMemu> getPage(RoleMemu userMemu) {
        return new PageInfo<>(roleMenuMapper.list(userMemu));
    }

    @Override
    public RoleMemu getById(Long id) {
        return roleMenuMapper.queryOneById(id);
    }

    @Override
    public Integer getCount(RoleMemu roleMemu) {
        return roleMenuMapper.count(roleMemu);
    }
}
